//1-1获取控件版本
	function KS_GetVersions() {
		var result;
		var str="1";
		$.ajax({
			type :"POST",
			url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
			async : false,
			cache: false,
			data:JSON.stringify({"interface_type":str}),
			success : function(data) {		
				var mes = JSON.parse( data );
				result=mes.str_version;
			}
			});	
		return result;
		
	}
//3.2-4设置算法提供者KS_SetProv
function KS_SetProvs(str_prov,lalg,str_path) {
	var result;
	var interface_type="2";
/*	var str_prov=str_prov;
	var lalg=lalg;
	var str_path=str_path;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_prov":str_prov,"lalg":Number(lalg),"str_path":str_path}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.error_code;
		}
		});	
	return result;
}
//3.3-3设置参数 KS_SetParam
function KS_SetParams(str_paramname,str_path) {
	var result;
	var interface_type="3";
/*	var str_paramname;
	var str_path;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_paramname":str_paramname,"str_path":str_path}),
		success : function(data) {	
			var mes = JSON.parse( data );
			result=mes.error_code;
		}
		});	
	return result;
}
//3.4-2获取参数 KS_GetParam
function KS_GetParams(str_paramname) {
	var result;
	var interface_type="4";
	//var str_paramname;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_paramname":str_paramname}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_paramdata;
		}
		});	
	return result;
}

//3.9读取公钥证书KS_GetCert
function KS_GetCerts(str_type) {
	var result;
	var interface_type="9";
	//var str_type;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_type":Number(str_type)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_base64cert;
		}
		});	
	return result;
}
//3.10解析证书KS_GetCertInfo
function KS_GetCertInfos(str_cert,str_type) {
	var result;
	var interface_type="10";
	/*var str_cert;
	var str_type;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_cert":str_cert,"str_type":Number(str_type)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			
			result=mes.str_info;
		}
		});	
	return result;
}
//3.11解析证书扩展项KS_GetCertInfoByOid
function KS_GetCertInfoByOids(str_cert, str_type) {
	var result;
	var interface_type="11";
	//var str_cert;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_cert":str_cert, "str_type":str_type}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_info;
		}
		});	
	return result;
}
//3.12随机数KS_GenRandom
function KS_GenRandoms(str_len) {
	var result;
	var interface_type="12";
	//var str_len;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_len":Number(str_len)}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_random;
		}
		});	
	return result;
}
//3.13摘要数据KS_HashData
function KS_HashDatas(str_indata,str_alg) {
	var result;
	var interface_type="13";
	/*var str_indata;
	var str_alg;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_indata":str_indata,"str_alg":Number(str_alg)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_hashdata;
		}
		});	
	return result;
}

//3.15签名数据KS_SignData
function KS_SignDatas(str_indata,str_hashalg) {
	var result;
	var interface_type="15";
	/*var str_indata;
	var str_hashalg;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_indata":str_indata,"str_hashalg":Number(str_hashalg)}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_signdata;
		}
		});	
	return result;
}
//3.16-5验证签名KS_VerifySignData
function KS_VerifySignDatas(str_indata,str_signdata,str_cert,str_hashalg) {
	var result;
	var interface_type="16";
/*	var str_indata;
	var str_signdata;
	var str_cert;
	var str_hashalg;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_indata":str_indata,"str_signdata":str_signdata,"str_cert":str_cert,"str_hashalg":Number(str_hashalg)}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.error_code;
		}
		});	
	return result;
}
//3.17验证P7签名KS_VerifyP7SignData
function KS_VerifyP7SignDatas(str_p7signdata) {
	var result;
	var interface_type="17";
	//var str_p7signdata;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_p7signdata":str_p7signdata}),
		success : function(data) {
			var mes = JSON.parse( data );	
			
			result=mes.error_code;
		}
		});	
	return result;
}

//3.19对称加密KS_SymmEncrypt
function KS_SymmEncrypts(str_oridata,str_key,str_symmalg) {
	var result;
	var interface_type="19";
/*	var str_oridata;
	var str_key;
	var str_symmalg;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_oridata":str_oridata,"str_key":str_key,"str_symmalg":Number(str_symmalg)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_encdata;
		}
		});	
	return result;
}
//3.20对称解密KS_SymmDecrypt
function KS_SymmDecrypts(str_encdata,str_key,str_symmalg) {
	var result;
	var interface_type="20";
/*	var str_encdata;
	var str_key;
	var str_symmalg;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_encdata":str_encdata,"str_key":str_key,"str_symmalg":Number(str_symmalg)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_oridata;
		}
		});	
	return result;
}
//3.21组数字信封KS_MakeEnvelope
function KS_MakeEnvelopes(str_oridata,str_base64cert) {
	var result;
	var interface_type="21";
	/*var str_oridata;
	var str_base64cert;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_oridata":str_oridata,"str_base64cert":str_base64cert}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_envelope;
		}
		});	
	return result;
}
//3.22解数字信封KS_OpenEnvelop
function KS_OpenEnvelops(str_envelope) {
	var result;
	var interface_type="22";
	//var str_envelope;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_envelope":str_envelope}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_oridata;
		}
		});	
	return result;
}
//3.23获得硬件介质号 KS_GetAllDeviceSerialNumber
function KS_GetAllDeviceSerialNumbers() {
	var result;
	var interface_type="23";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_serialnumber;
		}
		});	
	return result;
}

//3.28验证PIN码函数 KS_CheckPIN
function KS_CheckPINs(str_pin) {
	var result;
	var interface_type="28";
	//var str_pin;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_pin":str_pin}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.error_code;
		}
		});	
	return result;
}
//3.29获取设备VID KS_GetDeviceVid
function  KS_GetDeviceVids() {
	var result;
	var interface_type="29";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_devicevid;
		}
		});	
	return result;
}
//3.30获取设备CSP KS_GetDeviceCSP
function KS_GetDeviceCSPs() {
	var result;
	var interface_type="30";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_devicecsp;
		}
		});	
	return result;
}

//3.40获取最后操作错误码KS_GetLastErrorCode
function KS_GetLastErrorCodes() {
	var result;
	var interface_type="40";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.error_code;
		}
		});	
	return result;
}
//3.41获取最后操作错误描述KS_GetLastErrorMsg
function KS_GetLastErrorMsgs() {
	var result;
	var interface_type="41";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.b_stateflag;
		}
		});	
	return result;
}

//3.43获取公共资源的印章 KS_GGZYGainSeal
function KS_GGZYGainSeals(bstrExtend) {
	var result;
	var interface_type="GS";
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_Extend":bstrExtend}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_SealData;
		}
		});	
	return result;
}
//3.201对hash签名KS_SignHashData
function KS_SignHashDatas(str_indata,str_hashalg) {
	var result;
	var interface_type="201";
	/*var str_sealdata;
	var str_type;*/
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_InData":str_indata,"str_lHashAlg":Number(str_hashalg)}),
		success : function(data) {
			var mes = JSON.parse( data );	
			result=mes.str_info;
		}
		});	
	return result;
}

//3.22解数字信封兼容接口KS_GGZYCompatibleOpenEnvelope
function KS_GGZYCompatibleOpenEnvelopes(str_envelope) {
	var result;
	var interface_type="GGZYOE";
	//var str_envelope;
	$.ajax({
		type :"POST",
		url : "http://localhost:9102/WebServerPrinter/Client/signPostData.do",
		async : false,
		cache: false,
		data:JSON.stringify({"interface_type":interface_type,"str_envelope":str_envelope}),
		success : function(data) {
			var mes = JSON.parse( data );
			result=mes.str_oridata;
		}
		});	
	return result;
}